let v = new Vue({
    el: '#app',
    data: {
        hot:[],     //热门商品
        news:[]     //最新商品
    },
    methods: {
        initHome:function () {
            axios(`goods/initHome`)
                .then(rsp=>{
                    if (rsp.data.flag){
                        this.hot = rsp.data.data.hot;
                        this.news = rsp.data.data.news;
                    }
                })
                .catch(error=>{
                    layer.msg(error.message);
                });
        },
        toGoodsDetail:function (id) {
             localStorage.setItem("aid",id);
        }
    },
    created: function () {
        this.initHome();
    }
});